Skip to content

feat: move Redis family to clientless validation - #136

Open
cofin wants to merge 2 commits into
feat/provider-aware-cifrom
feat/clientless-redis-family
Open

feat: move Redis family to clientless validation#136
cofin wants to merge 2 commits into
feat/provider-aware-cifrom
feat/clientless-redis-family

Conversation

@cofin

@cofin cofin commented May 24, 2026

Copy link
Copy Markdown
Member

Move readiness off the redis Python client. The redis_service, dragonfly_service, and keydb_service fixtures now ping through a small sidecar (redis:latest on network_mode=host) running redis-cli.

tests/test_redis.py drives every parametrized service through the same sidecar helper, covering image override, default no-xdist, xdist database isolation, and xdist server isolation across the four wire-compatible images (redis, valkey, keydb, dragonflydb).

The redis, keydb, and dragonfly extras are now empty compatibility groups — users install their own client. types-redis is gone from the lint group.

cofin added a commit that referenced this pull request May 24, 2026
Match the fix landing in concurrent clientless-* PRs (#134, #135, #136,
#137, #138). pytest-cdist 0.3.x accepts only one steal entry, and 3:10
leaves the middle shard empty when file justification moves a large
test file across the chunk boundary, failing CI.
cofin added a commit that referenced this pull request May 25, 2026
Replace the `google.cloud.bigquery` / `google.api_core.client_options` /
`google.auth.credentials` imports with a stdlib `urllib.request` REST
probe against the emulator's `/bigquery/v2/projects/<project>/queries`
endpoint, mirroring the Elasticsearch (#139), Valkey (#138), and Redis
family (#136) clientless conversions.

- src/pytest_databases/docker/bigquery.py: drop the three `google.*`
  imports; remove `credentials` and `client_options` from
  `BigQueryService` (keep `host`, `port`, `container`, `project`,
  `dataset`, and the `endpoint` property); add a
  `_query_bigquery_emulator(host, port, project, sql, *, timeout=2.0)`
  helper that POSTs `{"query": sql, "useLegacySql": false}` and parses
  the response; rewrite `check()` to call the helper with `SELECT 1 as
  one` and assert `jobComplete and rows[0].f[0].v == "1"`, swallowing
  `URLError`/`HTTPError`/`JSONDecodeError`/`TimeoutError`/`OSError`;
  delete the `bigquery_client` fixture. The emulator `--dataset=` start
  flag and `DATASET_NAME` env var are preserved so the default dataset
  is still auto-created by the emulator binary itself.
- tests/test_bigquery.py: rewrite to drive the emulator through stdlib
  `urllib.request` only; preserve `test_service_fixture` (SELECT 1 via
  REST); drop `test_client_fixture`; rewrite `test_xdist` to issue
  `CREATE TABLE` against `bigquery_service.dataset` via the REST
  endpoint; add `test_plugin_imports_without_google_cloud_bigquery`
  regression guard that intercepts `google.cloud.bigquery`,
  `google.api_core.client_options`, and `google.auth.credentials` via
  `builtins.__import__`.
- pyproject.toml: empty the `bigquery` compatibility extra so
  `pytest-databases[bigquery]` no longer pulls in
  `google-cloud-bigquery`; drop the `pytest_databases.docker.bigquery`
  `attr-defined` mypy override now that the module no longer touches
  Google client attribute surface.
- docs/supported-databases/bigquery.rst: rewrite the example in the
  user-owned-client style; users now build their own `bigquery.Client`
  from `bigquery_service.endpoint`, `bigquery_service.project`, and
  `AnonymousCredentials()`.
- uv.lock: drop `google-cloud-bigquery`, `google-crc32c`, and
  `google-resumable-media`.
cofin added a commit that referenced this pull request May 25, 2026
Match the fix landing in concurrent clientless-* PRs (#134, #135, #136,
#137, #138). pytest-cdist 0.3.x accepts only one steal entry, and 3:10
leaves the middle shard empty when file justification moves a large
test file across the chunk boundary, failing CI.
@cofin
cofin force-pushed the feat/clientless-redis-family branch from e9bc388 to ab5fc08 Compare May 25, 2026 16:23
cofin added a commit that referenced this pull request Jul 21, 2026
Replace the `google.cloud.bigquery` / `google.api_core.client_options` /
`google.auth.credentials` imports with a stdlib `urllib.request` REST
probe against the emulator's `/bigquery/v2/projects/<project>/queries`
endpoint, mirroring the Elasticsearch (#139), Valkey (#138), and Redis
family (#136) clientless conversions.

- src/pytest_databases/docker/bigquery.py: drop the three `google.*`
  imports; remove `credentials` and `client_options` from
  `BigQueryService` (keep `host`, `port`, `container`, `project`,
  `dataset`, and the `endpoint` property); add a
  `_query_bigquery_emulator(host, port, project, sql, *, timeout=2.0)`
  helper that POSTs `{"query": sql, "useLegacySql": false}` and parses
  the response; rewrite `check()` to call the helper with `SELECT 1 as
  one` and assert `jobComplete and rows[0].f[0].v == "1"`, swallowing
  `URLError`/`HTTPError`/`JSONDecodeError`/`TimeoutError`/`OSError`;
  delete the `bigquery_client` fixture. The emulator `--dataset=` start
  flag and `DATASET_NAME` env var are preserved so the default dataset
  is still auto-created by the emulator binary itself.
- tests/test_bigquery.py: rewrite to drive the emulator through stdlib
  `urllib.request` only; preserve `test_service_fixture` (SELECT 1 via
  REST); drop `test_client_fixture`; rewrite `test_xdist` to issue
  `CREATE TABLE` against `bigquery_service.dataset` via the REST
  endpoint; add `test_plugin_imports_without_google_cloud_bigquery`
  regression guard that intercepts `google.cloud.bigquery`,
  `google.api_core.client_options`, and `google.auth.credentials` via
  `builtins.__import__`.
- pyproject.toml: empty the `bigquery` compatibility extra so
  `pytest-databases[bigquery]` no longer pulls in
  `google-cloud-bigquery`; drop the `pytest_databases.docker.bigquery`
  `attr-defined` mypy override now that the module no longer touches
  Google client attribute surface.
- docs/supported-databases/bigquery.rst: rewrite the example in the
  user-owned-client style; users now build their own `bigquery.Client`
  from `bigquery_service.endpoint`, `bigquery_service.project`, and
  `AnonymousCredentials()`.
- uv.lock: drop `google-cloud-bigquery`, `google-crc32c`, and
  `google-resumable-media`.
cofin added a commit that referenced this pull request Jul 21, 2026
Replace the `google.cloud.bigquery` / `google.api_core.client_options` /
`google.auth.credentials` imports with a stdlib `urllib.request` REST
probe against the emulator's `/bigquery/v2/projects/<project>/queries`
endpoint, mirroring the Elasticsearch (#139), Valkey (#138), and Redis
family (#136) clientless conversions.

- src/pytest_databases/docker/bigquery.py: drop the three `google.*`
  imports; remove `credentials` and `client_options` from
  `BigQueryService` (keep `host`, `port`, `container`, `project`,
  `dataset`, and the `endpoint` property); add a
  `_query_bigquery_emulator(host, port, project, sql, *, timeout=2.0)`
  helper that POSTs `{"query": sql, "useLegacySql": false}` and parses
  the response; rewrite `check()` to call the helper with `SELECT 1 as
  one` and assert `jobComplete and rows[0].f[0].v == "1"`, swallowing
  `URLError`/`HTTPError`/`JSONDecodeError`/`TimeoutError`/`OSError`;
  delete the `bigquery_client` fixture. The emulator `--dataset=` start
  flag and `DATASET_NAME` env var are preserved so the default dataset
  is still auto-created by the emulator binary itself.
- tests/test_bigquery.py: rewrite to drive the emulator through stdlib
  `urllib.request` only; preserve `test_service_fixture` (SELECT 1 via
  REST); drop `test_client_fixture`; rewrite `test_xdist` to issue
  `CREATE TABLE` against `bigquery_service.dataset` via the REST
  endpoint; add `test_plugin_imports_without_google_cloud_bigquery`
  regression guard that intercepts `google.cloud.bigquery`,
  `google.api_core.client_options`, and `google.auth.credentials` via
  `builtins.__import__`.
- pyproject.toml: empty the `bigquery` compatibility extra so
  `pytest-databases[bigquery]` no longer pulls in
  `google-cloud-bigquery`; drop the `pytest_databases.docker.bigquery`
  `attr-defined` mypy override now that the module no longer touches
  Google client attribute surface.
- docs/supported-databases/bigquery.rst: rewrite the example in the
  user-owned-client style; users now build their own `bigquery.Client`
  from `bigquery_service.endpoint`, `bigquery_service.project`, and
  `AnonymousCredentials()`.
- uv.lock: drop `google-cloud-bigquery`, `google-crc32c`, and
  `google-resumable-media`.
@cofin
cofin force-pushed the feat/clientless-redis-family branch from ab5fc08 to 3f8491c Compare July 21, 2026 17:13
@cofin
cofin changed the base branch from main to feat/provider-aware-ci July 21, 2026 18:51
@cofin
cofin force-pushed the feat/clientless-redis-family branch from 3f8491c to 6899a81 Compare July 22, 2026 03:52
cofin added a commit that referenced this pull request Jul 22, 2026
Replace the `google.cloud.bigquery` / `google.api_core.client_options` /
`google.auth.credentials` imports with a stdlib `urllib.request` REST
probe against the emulator's `/bigquery/v2/projects/<project>/queries`
endpoint, mirroring the Elasticsearch (#139), Valkey (#138), and Redis
family (#136) clientless conversions.

- src/pytest_databases/docker/bigquery.py: drop the three `google.*`
  imports; remove `credentials` and `client_options` from
  `BigQueryService` (keep `host`, `port`, `container`, `project`,
  `dataset`, and the `endpoint` property); add a
  `_query_bigquery_emulator(host, port, project, sql, *, timeout=2.0)`
  helper that POSTs `{"query": sql, "useLegacySql": false}` and parses
  the response; rewrite `check()` to call the helper with `SELECT 1 as
  one` and assert `jobComplete and rows[0].f[0].v == "1"`, swallowing
  `URLError`/`HTTPError`/`JSONDecodeError`/`TimeoutError`/`OSError`;
  delete the `bigquery_client` fixture. The emulator `--dataset=` start
  flag and `DATASET_NAME` env var are preserved so the default dataset
  is still auto-created by the emulator binary itself.
- tests/test_bigquery.py: rewrite to drive the emulator through stdlib
  `urllib.request` only; preserve `test_service_fixture` (SELECT 1 via
  REST); drop `test_client_fixture`; rewrite `test_xdist` to issue
  `CREATE TABLE` against `bigquery_service.dataset` via the REST
  endpoint; add `test_plugin_imports_without_google_cloud_bigquery`
  regression guard that intercepts `google.cloud.bigquery`,
  `google.api_core.client_options`, and `google.auth.credentials` via
  `builtins.__import__`.
- pyproject.toml: empty the `bigquery` compatibility extra so
  `pytest-databases[bigquery]` no longer pulls in
  `google-cloud-bigquery`; drop the `pytest_databases.docker.bigquery`
  `attr-defined` mypy override now that the module no longer touches
  Google client attribute surface.
- docs/supported-databases/bigquery.rst: rewrite the example in the
  user-owned-client style; users now build their own `bigquery.Client`
  from `bigquery_service.endpoint`, `bigquery_service.project`, and
  `AnonymousCredentials()`.
- uv.lock: drop `google-cloud-bigquery`, `google-crc32c`, and
  `google-resumable-media`.
cofin added a commit that referenced this pull request Jul 22, 2026
Replace the `google.cloud.bigquery` / `google.api_core.client_options` /
`google.auth.credentials` imports with a stdlib `urllib.request` REST
probe against the emulator's `/bigquery/v2/projects/<project>/queries`
endpoint, mirroring the Elasticsearch (#139), Valkey (#138), and Redis
family (#136) clientless conversions.

- src/pytest_databases/docker/bigquery.py: drop the three `google.*`
  imports; remove `credentials` and `client_options` from
  `BigQueryService` (keep `host`, `port`, `container`, `project`,
  `dataset`, and the `endpoint` property); add a
  `_query_bigquery_emulator(host, port, project, sql, *, timeout=2.0)`
  helper that POSTs `{"query": sql, "useLegacySql": false}` and parses
  the response; rewrite `check()` to call the helper with `SELECT 1 as
  one` and assert `jobComplete and rows[0].f[0].v == "1"`, swallowing
  `URLError`/`HTTPError`/`JSONDecodeError`/`TimeoutError`/`OSError`;
  delete the `bigquery_client` fixture. The emulator `--dataset=` start
  flag and `DATASET_NAME` env var are preserved so the default dataset
  is still auto-created by the emulator binary itself.
- tests/test_bigquery.py: rewrite to drive the emulator through stdlib
  `urllib.request` only; preserve `test_service_fixture` (SELECT 1 via
  REST); drop `test_client_fixture`; rewrite `test_xdist` to issue
  `CREATE TABLE` against `bigquery_service.dataset` via the REST
  endpoint; add `test_plugin_imports_without_google_cloud_bigquery`
  regression guard that intercepts `google.cloud.bigquery`,
  `google.api_core.client_options`, and `google.auth.credentials` via
  `builtins.__import__`.
- pyproject.toml: empty the `bigquery` compatibility extra so
  `pytest-databases[bigquery]` no longer pulls in
  `google-cloud-bigquery`; drop the `pytest_databases.docker.bigquery`
  `attr-defined` mypy override now that the module no longer touches
  Google client attribute surface.
- docs/supported-databases/bigquery.rst: rewrite the example in the
  user-owned-client style; users now build their own `bigquery.Client`
  from `bigquery_service.endpoint`, `bigquery_service.project`, and
  `AnonymousCredentials()`.
- uv.lock: drop `google-cloud-bigquery`, `google-crc32c`, and
  `google-resumable-media`.
@cofin
cofin force-pushed the feat/clientless-redis-family branch from 6899a81 to a5c0e37 Compare July 22, 2026 05:08
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 26 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (feat/provider-aware-ci@f0b2684). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/pytest_databases/docker/redis.py 0.00% 26 Missing ⚠️
Additional details and impacted files
@@                   Coverage Diff                    @@
##             feat/provider-aware-ci    #136   +/-   ##
========================================================
  Coverage                          ?   6.10%           
========================================================
  Files                             ?      22           
  Lines                             ?    1817           
  Branches                          ?     135           
========================================================
  Hits                              ?     111           
  Misses                            ?    1683           
  Partials                          ?      23           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

cofin added a commit that referenced this pull request Jul 22, 2026
Replace the `google.cloud.bigquery` / `google.api_core.client_options` /
`google.auth.credentials` imports with a stdlib `urllib.request` REST
probe against the emulator's `/bigquery/v2/projects/<project>/queries`
endpoint, mirroring the Elasticsearch (#139), Valkey (#138), and Redis
family (#136) clientless conversions.

- src/pytest_databases/docker/bigquery.py: drop the three `google.*`
  imports; remove `credentials` and `client_options` from
  `BigQueryService` (keep `host`, `port`, `container`, `project`,
  `dataset`, and the `endpoint` property); add a
  `_query_bigquery_emulator(host, port, project, sql, *, timeout=2.0)`
  helper that POSTs `{"query": sql, "useLegacySql": false}` and parses
  the response; rewrite `check()` to call the helper with `SELECT 1 as
  one` and assert `jobComplete and rows[0].f[0].v == "1"`, swallowing
  `URLError`/`HTTPError`/`JSONDecodeError`/`TimeoutError`/`OSError`;
  delete the `bigquery_client` fixture. The emulator `--dataset=` start
  flag and `DATASET_NAME` env var are preserved so the default dataset
  is still auto-created by the emulator binary itself.
- tests/test_bigquery.py: rewrite to drive the emulator through stdlib
  `urllib.request` only; preserve `test_service_fixture` (SELECT 1 via
  REST); drop `test_client_fixture`; rewrite `test_xdist` to issue
  `CREATE TABLE` against `bigquery_service.dataset` via the REST
  endpoint; add `test_plugin_imports_without_google_cloud_bigquery`
  regression guard that intercepts `google.cloud.bigquery`,
  `google.api_core.client_options`, and `google.auth.credentials` via
  `builtins.__import__`.
- pyproject.toml: empty the `bigquery` compatibility extra so
  `pytest-databases[bigquery]` no longer pulls in
  `google-cloud-bigquery`; drop the `pytest_databases.docker.bigquery`
  `attr-defined` mypy override now that the module no longer touches
  Google client attribute surface.
- docs/supported-databases/bigquery.rst: rewrite the example in the
  user-owned-client style; users now build their own `bigquery.Client`
  from `bigquery_service.endpoint`, `bigquery_service.project`, and
  `AnonymousCredentials()`.
- uv.lock: drop `google-cloud-bigquery`, `google-crc32c`, and
  `google-resumable-media`.
@cofin
cofin force-pushed the feat/clientless-redis-family branch from a5c0e37 to cc7e85a Compare July 22, 2026 15:56
from pytest_databases._service import DockerService


REDIS_PROBE_IMAGE = "redis:latest"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be the same image as the redis that's currently running. Otherwise it might be an unnecessary pull

probe_image: str = REDIS_PROBE_IMAGE,
) -> tuple[int, bytes]:
try:
output = docker_service._client.containers.run(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use the already running container for this? We could modify check so you can pass in a function that takes the running Container as an argument

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants